<? if ($errors = $form->errors()): ?>
<div id="form-errors">
	<? foreach ($errors as $error): ?>
		<p class="error"><?= self::escape_html($error) ?></p>
	<? endforeach; ?>
</div>
<? endif; ?>

<? $form->setFormClass('', 'error'); ?>
<? $form->setDefaultLabelClass('', 'error');  ?>
<? $form->setDefaultFieldClass('', 'error'); ?>

<?= $form->open(); ?>
	<h4 class="edit-title"><?= $form->title() ?></h4>
	<ul>
<? foreach ($form->fields() as $name => $field): ?>
	<? if ($field['type'] == 'fieldset_open'): ?>
		<li><ul class="<?= isset($field['atts']['class']) ? $field['atts']['class'] : 'sublist' ?>">
		<? continue; ?>
	<? endif ?>
	<? if ($field['type'] == 'fieldset_close'): ?>
		</ul></li>
		<? continue; ?>
	<? endif ?>
	<li<?= isset($field['atts']['id']) ? " id=\"{$field['atts']['id']}-wrapper\"" : ''; isset($field['type']) ? " class=\"{$field['type']}\"" : '' ?>><?= $form->renderField($name) ?></li>
<? endforeach; ?>
	</ul>
<?= $form->close(); ?>
